package cn.jbolt.meinvtu.robot;

import com.jfinal.aop.Before;
import com.jfinal.aop.Inject;
import com.jfinal.core.ActionKey;
import com.jfinal.core.Controller;
import com.jfinal.kit.Ret;
import com.jfinal.plugin.activerecord.tx.Tx;

public class RobotController extends Controller {
	@Inject
	private RobotService service;
	@ActionKey("/")
	public void index(){
		render("index.html");
	}
	@Before(Tx.class)
	public void start(){
		try {
			renderJson(service.startCrawling(getInt(0)));
		} catch (Exception e) {
			renderJson(Ret.fail("msg","哎呀，失败了！"));
		}
		
	}
}
